﻿using System;

namespace MessagePack.Formatters
{
	// Token: 0x0200003B RID: 59
	public class NullableUInt32Formatter : IMessagePackFormatter<uint?>
	{
		// Token: 0x060000DB RID: 219 RVA: 0x000043CC File Offset: 0x000027CC
		private NullableUInt32Formatter()
		{
		}

		// Token: 0x060000DC RID: 220 RVA: 0x000043D4 File Offset: 0x000027D4
		public int Serialize(ref byte[] bytes, int offset, uint? value, IFormatterResolver formatterResolver)
		{
			if (value == null)
			{
				return MessagePackBinary.WriteNil(ref bytes, offset);
			}
			return MessagePackBinary.WriteUInt32(ref bytes, offset, value.Value);
		}

		// Token: 0x060000DD RID: 221 RVA: 0x000043FC File Offset: 0x000027FC
		public uint? Deserialize(byte[] bytes, int offset, IFormatterResolver formatterResolver, out int readSize)
		{
			if (MessagePackBinary.IsNil(bytes, offset))
			{
				readSize = 1;
				return null;
			}
			return new uint?(MessagePackBinary.ReadUInt32(bytes, offset, out readSize));
		}

		// Token: 0x0400002F RID: 47
		public static readonly NullableUInt32Formatter Instance = new NullableUInt32Formatter();
	}
}
